package cn.csq.design.creatation.singleton;


/**
 * singleton  单例模式  工厂模式 factory
 */
public class Person {
    private String name;
    private String age;

    /**
     * 私有构造方法
     */
    private  Person(){

    }
    private static  volatile Person instance  = null;

    public static Person getInstance() {
        synchronized (Person.class) {
            if (instance == null) {
                synchronized (Person.class) {
                    instance = new Person();
                }
            }
        }
        return instance;
    }











}
